home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / misc / dspice0s / pnjlim.c < prev    next >
C/C++ Source or Header  |  1992-11-21  |  2KB  |  73 lines

  1. /* pnjlim.f -- translated by f2c (version of 3 February 1990  3:36:42).
  2.    You must link the resulting object file with the libraries:
  3.     -lF77 -lI77 -lm -lc   (in that order)
  4. */
  5.  
  6. #include "f2c.h"
  7.  
  8. /*<       subroutine pnjlim(vnew,vold,vt,vcrit,icheck) >*/
  9. /* Subroutine */ int pnjlim_(vnew, vold, vt, vcrit, icheck)
  10. doublereal *vnew, *vold, *vt, *vcrit;
  11. integer *icheck;
  12. {
  13.     /* Builtin functions */
  14.     double log();
  15.  
  16.     /* Local variables */
  17.     static doublereal delv, vlim, arg;
  18.  
  19. /*<       implicit double precision (a-h,o-z) >*/
  20.  
  21. /*     this routine limits the change-per-iteration of device pn-junction 
  22. */
  23. /* voltages. */
  24.  
  25. /*<       if (vnew.le.vcrit) go to 30 >*/
  26.     if (*vnew <= *vcrit) {
  27.     goto L30;
  28.     }
  29. /*<       vlim=vt+vt >*/
  30.     vlim = *vt + *vt;
  31. /*<       delv=vnew-vold >*/
  32.     delv = *vnew - *vold;
  33. /*<       if (dabs(delv).le.vlim) go to 30 >*/
  34.     if (abs(delv) <= vlim) {
  35.     goto L30;
  36.     }
  37. /*<       if (vold.le.0.0d0) go to 20 >*/
  38.     if (*vold <= 0.) {
  39.     goto L20;
  40.     }
  41. /*<       arg=1.0d0+delv/vt >*/
  42.     arg = delv / *vt + 1.;
  43. /*<       if (arg.le.0.0d0) go to 10 >*/
  44.     if (arg <= 0.) {
  45.     goto L10;
  46.     }
  47. /*<       vnew=vold+vt*dlog(arg) >*/
  48.     *vnew = *vold + *vt * log(arg);
  49. /*<       go to 100 >*/
  50.     goto L100;
  51. /*<    10 vnew=vcrit >*/
  52. L10:
  53.     *vnew = *vcrit;
  54. /*<       go to 100 >*/
  55.     goto L100;
  56. /*<    20 vnew=vt*dlog(vnew/vt) >*/
  57. L20:
  58.     *vnew = *vt * log(*vnew / *vt);
  59. /*<       go to 100 >*/
  60.     goto L100;
  61. /*<    30 icheck=0 >*/
  62. L30:
  63.     *icheck = 0;
  64.  
  65. /*  finished */
  66.  
  67. /*<   100 return >*/
  68. L100:
  69.     return 0;
  70. /*<       end >*/
  71. } /* pnjlim_ */
  72.  
  73.